import java.util.Scanner;

public class MinDictOrderString {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int T = scanner.nextInt(); // 读取测试数据的组数

        while (T-- > 0) {
            int n = scanner.nextInt(); // 读取字符串长度
            int k = scanner.nextInt(); // 读取操作次数
            String s = scanner.next(); // 读取字符串

            char[] stringArray = s.toCharArray();
            int onesCount = 0;
            for (char c : stringArray) {
                if (c == '1') onesCount++;
            }

            int zerosToMove = Math.min(k, onesCount);
            for (int i = 0; i < zerosToMove; i++) {
                // 找到第一个'1'并将其与'0'交换
                for (int j = 0; j < n; j++) {
                    if (stringArray[j] == '1') {
                        stringArray[j] = '0';
                        for (int z = 0; z < n; z++) {
                            if (stringArray[z] == '0') {
                                stringArray[z] = '1';
                                break;
                            }
                        }
                        break;
                    }
                }
            }

            System.out.println(new String(stringArray));
        }
        scanner.close();
    }
}
